package logic

import (
	"context"
	"doctor-medicine-system/model/mysql"

	"doctor-medicine-system/doctorrpc/doctorrpc"
	"doctor-medicine-system/doctorrpc/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type GoodsListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewGoodsListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *GoodsListLogic {
	return &GoodsListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 列表
func (l *GoodsListLogic) GoodsList(in *doctorrpc.GoodsListRequest) (*doctorrpc.GoodsListResponse, error) {
	// todo: add your logic here and delete this line

	var list []*doctorrpc.GoodsList

	list = mysql.GoodsList(mysql.DB, in.GoodsId)

	return &doctorrpc.GoodsListResponse{
		List: list,
	}, nil
}
